package commons.groovy;

import groovy.lang.GroovyClassLoader;

import java.lang.reflect.Field;

import org.springframework.util.ResourceUtils;

public class GLoadTest {

	public static GroovyClassLoader cloader = new GroovyClassLoader(GroovyInstance.class.getClassLoader());

	public static void main(String[] args) throws Exception {

		Class<?> c1 = cloader.parseClass(ResourceUtils.getFile("classpath:commons/groovy/TestBook.groovy"));
		Class<?> c2 = cloader.parseClass(ResourceUtils.getFile("classpath:commons/groovy/TestBookParam.groovy"));
		
//		GroovyShell shell = new GroovyShell(cloader);
//		shell.evaluate("TestBook.test");
		Class<?> c3 = cloader.parseClass(ResourceUtils.getFile("classpath:commons/groovy/TestBook1.groovy"));
		
		
		System.out.println(c1);
		System.out.println(c2);
		System.out.println(c3);
		Field f = c3.getField("test");
		System.out.println(f.getName());
	}

	private String id ;
	
	private Boolean yes ;
	
	private boolean no ;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Boolean getYes() {
		return yes;
	}

	public void setYes(Boolean yes) {
		this.yes = yes;
	}

	public boolean isNo() {
		return no;
	}

	public void setNo(boolean no) {
		this.no = no;
	}
	
	
	
	
}
